import yaml, os
from easydict import EasyDict

root = "../data/config/"

commonConfigFile = os.path.join(os.path.dirname(__file__), root + 'commonConfig.yaml').replace("\\", "/")
opcUaConfigFile = os.path.join(os.path.dirname(__file__), root + 'opcUaConfig.yaml').replace("\\", "/")
yawConfigFile = os.path.join(os.path.dirname(__file__), root + 'yawConfig.yaml').replace("\\", "/")
torqueConfigFile = os.path.join(os.path.dirname(__file__), root + 'torqueConfig.yaml').replace("\\", "/")
pitchConfigFile = os.path.join(os.path.dirname(__file__), root + 'pitchConfig.yaml').replace("\\", "/")

commonConfigFile = open(commonConfigFile,"r",encoding="utf_8").read()
opcUaConfigFile = open(opcUaConfigFile,"r",encoding="utf_8").read()
yawConfigFile = open(yawConfigFile,"r",encoding="utf_8").read()
torqueConfigFile = open(torqueConfigFile,"r",encoding="utf_8").read()
pitchConfigFile = open(pitchConfigFile,"r",encoding="utf_8").read()

commonConfig = EasyDict(yaml.safe_load(commonConfigFile))
opcUaConfig = EasyDict(yaml.safe_load("{}{}".format(commonConfigFile,opcUaConfigFile)))
yawConfig = EasyDict(yaml.safe_load("{}{}".format(commonConfigFile,yawConfigFile)))
torqueConfig = EasyDict(yaml.safe_load("{}{}".format(commonConfigFile,torqueConfigFile)))
pitchConfig = EasyDict(yaml.safe_load("{}{}".format(commonConfigFile,pitchConfigFile)))

#
# print(pitchConfig.PitchAngle)